const { defineConfig } = require("@vue/cli-service");
const AutoImport = require("unplugin-auto-import/webpack");
const Components = require("unplugin-vue-components/webpack");
const { ElementPlusResolver } = require("unplugin-vue-components/resolvers");

module.exports = defineConfig({
  // publicPath: "./",
  transpileDependencies: true,
  configureWebpack: (config) => {
    config.plugins.push(
      AutoImport({
        imports: ['vue', 'vue-router'],
        resolvers: [ElementPlusResolver()],
      })
    );
    config.plugins.push(
      Components({
        resolvers: [ElementPlusResolver()],
      })
    );
  },
  devServer: {
    proxy: {
      "/api": {
        target: "http://www.123-server.com",
        changeOrigin: true,
        pathRewrite: { "^/api": "" }, // 移除请求路径中的/api前缀
      },
    },
  },
});
